﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BT2_XuLyDuLieu
{
    public partial class BinningType : Form
    {
        private bool isWidth;
        private bool isOK;
        private int bins;

        public int Bins
        {
            get { return bins; }
            set { bins = value; }
        }

        public bool IsOK
        {
            get { return isOK; }
            set { isOK = value; }
        }

        public bool IsWidth
        {
            get { return isWidth; }
            set { isWidth = value; }
        }

        public BinningType()
        {
            InitializeComponent();
        }


        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            int tempBins = 0;
            if (int.TryParse(txtNumberOfBins.Text, out tempBins))
            {
                isWidth = rdoWidth.Checked ? true : false;
                isOK = true;
                bins = tempBins;
                this.Close();
            }
            else
            {
                MessageBox.Show("Number of bins must is a integer number!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}
